<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>主持人管理系统</title>
    <script>
        // 页面加载时设置默认用户信息
        (function() {
            // 设置默认的主持人管理用户信息
            if (!localStorage.getItem('hostCurrentUser')) {
                localStorage.setItem('hostCurrentUser', JSON.stringify({
                    name: '主持人管理员',
                    role: '主持人管理员'
                }));
                localStorage.setItem('hostIsLoggedIn', 'true');
            }
        })();
    </script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #333;
            min-height: 100vh;
        }

        .container {
            display: flex;
            min-height: 100vh;
        }

        /* 左侧侧边栏 */
        .sidebar {
            width: 280px;
            background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 50%, #3b82f6 100%);
            color: white;
            padding: 0;
            box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
            position: fixed;
            height: 100vh;
            overflow-y: auto;
        }

        .sidebar-header {
            padding: 30px 20px;
            background: rgba(255, 255, 255, 0.1);
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            margin-bottom: 20px;
            text-align: center;
        }

        .sidebar-title {
            font-size: 22px;
            font-weight: bold;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .nav-menu {
            list-style: none;
            padding: 0 15px;
        }

        .nav-item {
            margin-bottom: 8px;
        }

        .nav-link {
            display: flex;
            align-items: center;
            padding: 15px 20px;
            color: white;
            text-decoration: none;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            border-radius: 12px;
            border-left: 4px solid transparent;
        }

        .nav-link:hover, .nav-link.active {
            background: rgba(255, 255, 255, 0.1);
            border-left-color: #60a5fa;
            transform: translateX(5px);
        }

        .nav-icon {
            margin-right: 15px;
            font-size: 18px;
        }

        /* 右侧主内容区域 */
        .main-content {
            flex: 1;
            margin-left: 280px;
            padding: 30px;
            background: rgba(255, 255, 255, 0.95);
        }

        .content-header {
            background: white;
            padding: 25px 30px;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .header-left h1 {
            font-size: 28px;
            color: #1e3a8a;
            margin-bottom: 8px;
        }

        .breadcrumb {
            color: #6b7280;
            font-size: 14px;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .user-avatar {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            color: white;
        }

        .user-details {
            text-align: right;
        }

        .user-name {
            font-weight: bold;
            color: #1e3a8a;
            margin-bottom: 4px;
        }

        .user-role {
            color: #6b7280;
            font-size: 14px;
        }

        .btn-logout {
            background: #ef4444;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-logout:hover {
            background: #dc2626;
        }

        /* 功能模块样式 */
        .function-module {
            background: white;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
            overflow: hidden;
        }

        .module-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px 30px;
            font-size: 18px;
            font-weight: bold;
        }

        .module-content {
            padding: 30px;
        }

        /* 数据表格样式 */
        .data-table {
            width: 100%;
            border-collapse: collapse;
            background: white;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .data-table th {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px;
            text-align: left;
            font-weight: 600;
        }

        .data-table td {
            padding: 15px;
            border-bottom: 1px solid #e5e7eb;
        }

        .data-table tr:hover {
            background: #f8fafc;
        }

        .status-badge {
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
        }

        .status-active {
            background: #dcfce7;
            color: #166534;
        }

        .status-inactive {
            background: #fef2f2;
            color: #dc2626;
        }

        .status-enabled {
            background: #dcfce7;
            color: #166534;
        }

        .status-disabled {
            background: #f3f4f6;
            color: #6b7280;
        }

        .action-buttons {
            display: flex;
            gap: 8px;
        }

        .btn-action {
            padding: 6px 12px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            transition: all 0.3s ease;
        }

        .btn-action-view {
            background: #3b82f6;
            color: white;
        }

        .btn-action-view:hover {
            background: #2563eb;
        }

        .btn-action-edit {
            background: #f59e0b;
            color: white;
        }

        .btn-action-edit:hover {
            background: #d97706;
        }

        .btn-action-delete {
            background: #ef4444;
            color: white;
        }

        .btn-action-delete:hover {
            background: #dc2626;
        }

        .btn-action-enable {
            background: #10b981;
            color: white;
        }

        .btn-action-enable:hover {
            background: #059669;
        }

        .btn-action-disable {
            background: #6b7280;
            color: white;
        }

        .btn-action-disable:hover {
            background: #4b5563;
        }

        /* 表单样式 */
        .form-container {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 25px;
        }

        .form-group {
            display: flex;
            flex-direction: column;
        }

        .form-label {
            font-weight: 600;
            color: #374151;
            margin-bottom: 8px;
        }

        .form-input {
            padding: 12px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .form-textarea {
            padding: 12px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
            resize: vertical;
            min-height: 100px;
        }

        .form-textarea:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .form-actions {
            display: flex;
            gap: 15px;
            justify-content: flex-end;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-secondary {
            background: #6b7280;
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-secondary:hover {
            background: #4b5563;
        }

        /* 搜索区域样式 */
        .search-container {
            background: white;
            border-radius: 15px;
            padding: 20px 30px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .search-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            align-items: end;
        }

        .search-group {
            display: flex;
            flex-direction: column;
        }

        .search-label {
            font-weight: 600;
            color: #374151;
            margin-bottom: 8px;
        }

        .search-input {
            padding: 10px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .search-input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .search-actions {
            display: flex;
            gap: 10px;
        }

        .btn-search {
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-search-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .btn-search-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-search-secondary {
            background: #6b7280;
            color: white;
        }

        .btn-search-secondary:hover {
            background: #4b5563;
        }

        /* 模态框样式 */
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
        }

        .modal-content {
            background-color: #fefefe;
            margin: 5% auto;
            padding: 30px;
            border-radius: 15px;
            width: 90%;
            max-width: 600px;
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 2px solid #e5e7eb;
        }

        .modal-title {
            font-size: 20px;
            font-weight: bold;
            color: #1e3a8a;
        }

        .close {
            color: #aaa;
            font-size: 28px;
            font-weight: bold;
            cursor: pointer;
        }

        .close:hover {
            color: #000;
        }

        /* 表格响应式 */
        .table-container {
            overflow-x: auto;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .sidebar {
                width: 100%;
                position: relative;
                height: auto;
            }
            
            .main-content {
                margin-left: 0;
            }
            
            .header-top {
                flex-direction: column;
                gap: 20px;
                text-align: center;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 左侧侧边栏 -->
        <nav class="sidebar">
            <div class="sidebar-header">
                <div class="sidebar-title">主持人管理系统</div>
            </div>
            
            <ul class="nav-menu">
                <li class="nav-item">
                    <a href="#" class="nav-link active" onclick="switchFunction('add-host')">
                        <span class="nav-icon">➕</span>
                        <span class="nav-text">新增主持人</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link" onclick="switchFunction('modify-host')">
                        <span class="nav-icon">✏️</span>
                        <span class="nav-text">修改主持人</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link" onclick="switchFunction('delete-host')">
                        <span class="nav-icon">🗑️</span>
                        <span class="nav-text">删除主持人</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link" onclick="switchFunction('enable-disable-host')">
                        <span class="nav-icon">⚡</span>
                        <span class="nav-text">启用/停用主持人</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="organ-donation-management.html" class="nav-link">
                        <span class="nav-icon">🏠</span>
                        <span class="nav-text">返回主页</span>
                    </a>
                </li>
            </ul>
        </nav>

        <!-- 右侧主内容区域 -->
        <main class="main-content">
            <div class="content-header">
                <div class="header-top">
                    <div class="header-left">
                        <h1>主持人管理</h1>
                        <div class="breadcrumb">遗体捐献告别仪式管理 > 主持人管理</div>
                    </div>
                    <div class="user-info">
                        <div class="user-avatar">👤</div>
                        <div class="user-details">
                            <div class="user-name" id="current-user-name">主持人管理员</div>
                            <div class="user-role" id="current-user-role">主持人管理员</div>
                        </div>
                        <button class="btn-logout" onclick="logout()">退出登录</button>
                    </div>
                </div>
            </div>

            <!-- 新增主持人功能 -->
            <div id="add-host-content" class="content-section">
                <div class="function-module">
                    <div class="module-header">新增主持人</div>
                    <div class="module-content">
                        <div class="form-container">
                            <form id="add-host-form">
                                <div class="form-grid">
                                    <div class="form-group">
                                        <label class="form-label">主持人姓名 *</label>
                                        <input type="text" class="form-input" name="hostName" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">联系电话 *</label>
                                        <input type="tel" class="form-input" name="hostPhone" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">身份证号 *</label>
                                        <input type="text" class="form-input" name="hostIdCard" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">邮箱地址</label>
                                        <input type="email" class="form-input" name="hostEmail">
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">工作经验 *</label>
                                        <select class="form-input" name="hostExperience" required>
                                            <option value="">请选择工作经验</option>
                                            <option value="1-3年">1-3年</option>
                                            <option value="3-5年">3-5年</option>
                                            <option value="5-10年">5-10年</option>
                                            <option value="10年以上">10年以上</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">专业资质</label>
                                        <select class="form-input" name="hostQualification">
                                            <option value="">请选择专业资质</option>
                                            <option value="初级主持人">初级主持人</option>
                                            <option value="中级主持人">中级主持人</option>
                                            <option value="高级主持人">高级主持人</option>
                                            <option value="特级主持人">特级主持人</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="form-label">个人简介</label>
                                    <textarea class="form-textarea" name="hostBio" placeholder="请描述主持人的专业背景、特长和工作经历..."></textarea>
                                </div>
                                <div class="form-actions">
                                    <button type="button" class="btn-secondary" onclick="resetAddForm()">重置</button>
                                    <button type="submit" class="btn-primary">添加主持人</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 修改主持人功能 -->
            <div id="modify-host-content" class="content-section" style="display: none;">
                <div class="function-module">
                    <div class="module-header">修改主持人信息</div>
                    <div class="module-content">
                        <div class="search-container">
                            <div class="search-grid">
                                <div class="search-group">
                                    <label class="search-label">主持人姓名</label>
                                    <input type="text" class="search-input" id="modify-host-name-search" placeholder="输入主持人姓名">
                                </div>
                                <div class="search-group">
                                    <label class="search-label">工作经验</label>
                                    <select class="search-input" id="modify-host-experience-search">
                                        <option value="">全部经验</option>
                                        <option value="1-3年">1-3年</option>
                                        <option value="3-5年">3-5年</option>
                                        <option value="5-10年">5-10年</option>
                                        <option value="10年以上">10年以上</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">状态</label>
                                    <select class="search-input" id="modify-host-status-search">
                                        <option value="">全部状态</option>
                                        <option value="enabled">启用</option>
                                        <option value="disabled">停用</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">&nbsp;</label>
                                    <div class="search-actions">
                                        <button type="button" class="btn-search btn-search-primary" onclick="searchModifyHosts()">搜索</button>
                                        <button type="button" class="btn-search btn-search-secondary" onclick="clearModifySearch()">清除</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="table-container">
                            <table class="data-table">
                                <thead>
                                    <tr>
                                        <th>主持人ID</th>
                                        <th>姓名</th>
                                        <th>电话</th>
                                        <th>邮箱</th>
                                        <th>工作经验</th>
                                        <th>专业资质</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="modify-host-table-body">
                                    <tr>
                                        <td>H001</td>
                                        <td>张主持</td>
                                        <td>13900139000</td>
                                        <td>zhangzhuchi@example.com</td>
                                        <td>5-10年</td>
                                        <td>高级主持人</td>
                                        <td><span class="status-badge status-enabled">启用</span></td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewHost('H001')">查看</button>
                                            <button class="btn-action btn-action-edit" onclick="editHost('H001')">修改</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>H002</td>
                                        <td>李主持</td>
                                        <td>13800238000</td>
                                        <td>lizhuchi@example.com</td>
                                        <td>10年以上</td>
                                        <td>特级主持人</td>
                                        <td><span class="status-badge status-enabled">启用</span></td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewHost('H002')">查看</button>
                                            <button class="btn-action btn-action-edit" onclick="editHost('H002')">修改</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>H003</td>
                                        <td>王主持</td>
                                        <td>13700337000</td>
                                        <td>wangzhuchi@example.com</td>
                                        <td>3-5年</td>
                                        <td>中级主持人</td>
                                        <td><span class="status-badge status-disabled">停用</span></td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewHost('H003')">查看</button>
                                            <button class="btn-action btn-action-edit" onclick="editHost('H003')">修改</button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 删除主持人功能 -->
            <div id="delete-host-content" class="content-section" style="display: none;">
                <div class="function-module">
                    <div class="module-header">删除主持人</div>
                    <div class="module-content">
                        <div class="search-container">
                            <div class="search-grid">
                                <div class="search-group">
                                    <label class="search-label">主持人姓名</label>
                                    <input type="text" class="search-input" id="delete-host-name-search" placeholder="输入主持人姓名">
                                </div>
                                <div class="search-group">
                                    <label class="search-label">工作经验</label>
                                    <select class="search-input" id="delete-host-experience-search">
                                        <option value="">全部经验</option>
                                        <option value="1-3年">1-3年</option>
                                        <option value="3-5年">3-5年</option>
                                        <option value="5-10年">5-10年</option>
                                        <option value="10年以上">10年以上</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">状态</label>
                                    <select class="search-input" id="delete-host-status-search">
                                        <option value="">全部状态</option>
                                        <option value="enabled">启用</option>
                                        <option value="disabled">停用</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">&nbsp;</label>
                                    <div class="search-actions">
                                        <button type="button" class="btn-search btn-search-primary" onclick="searchDeleteHosts()">搜索</button>
                                        <button type="button" class="btn-search btn-search-secondary" onclick="clearDeleteSearch()">清除</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="table-container">
                            <table class="data-table">
                                <thead>
                                    <tr>
                                        <th>主持人ID</th>
                                        <th>姓名</th>
                                        <th>电话</th>
                                        <th>邮箱</th>
                                        <th>工作经验</th>
                                        <th>专业资质</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="delete-host-table-body">
                                    <tr>
                                        <td>H001</td>
                                        <td>张主持</td>
                                        <td>13900139000</td>
                                        <td>zhangzhuchi@example.com</td>
                                        <td>5-10年</td>
                                        <td>高级主持人</td>
                                        <td><span class="status-badge status-enabled">启用</span></td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewHost('H001')">查看</button>
                                            <button class="btn-action btn-action-delete" onclick="deleteHost('H001')">删除</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>H002</td>
                                        <td>李主持</td>
                                        <td>13800238000</td>
                                        <td>lizhuchi@example.com</td>
                                        <td>10年以上</td>
                                        <td>特级主持人</td>
                                        <td><span class="status-badge status-enabled">启用</span></td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewHost('H002')">查看</button>
                                            <button class="btn-action btn-action-delete" onclick="deleteHost('H002')">删除</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>H003</td>
                                        <td>王主持</td>
                                        <td>13700337000</td>
                                        <td>wangzhuchi@example.com</td>
                                        <td>3-5年</td>
                                        <td>中级主持人</td>
                                        <td><span class="status-badge status-disabled">停用</span></td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewHost('H003')">查看</button>
                                            <button class="btn-action btn-action-delete" onclick="deleteHost('H003')">删除</button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 启用/停用主持人功能 -->
            <div id="enable-disable-host-content" class="content-section" style="display: none;">
                <div class="function-module">
                    <div class="module-header">启用/停用主持人</div>
                    <div class="module-content">
                        <div class="search-container">
                            <div class="search-grid">
                                <div class="search-group">
                                    <label class="search-label">主持人姓名</label>
                                    <input type="text" class="search-input" id="status-host-name-search" placeholder="输入主持人姓名">
                                </div>
                                <div class="search-group">
                                    <label class="search-label">工作经验</label>
                                    <select class="search-input" id="status-host-experience-search">
                                        <option value="">全部经验</option>
                                        <option value="1-3年">1-3年</option>
                                        <option value="3-5年">3-5年</option>
                                        <option value="5-10年">5-10年</option>
                                        <option value="10年以上">10年以上</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">状态</label>
                                    <select class="search-input" id="status-host-status-search">
                                        <option value="">全部状态</option>
                                        <option value="enabled">启用</option>
                                        <option value="disabled">停用</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">&nbsp;</label>
                                    <div class="search-actions">
                                        <button type="button" class="btn-search btn-search-primary" onclick="searchStatusHosts()">搜索</button>
                                        <button type="button" class="btn-search btn-search-secondary" onclick="clearStatusSearch()">清除</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="table-container">
                            <table class="data-table">
                                <thead>
                                    <tr>
                                        <th>主持人ID</th>
                                        <th>姓名</th>
                                        <th>电话</th>
                                        <th>邮箱</th>
                                        <th>工作经验</th>
                                        <th>专业资质</th>
                                        <th>当前状态</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="status-host-table-body">
                                    <tr>
                                        <td>H001</td>
                                        <td>张主持</td>
                                        <td>13900139000</td>
                                        <td>zhangzhuchi@example.com</td>
                                        <td>5-10年</td>
                                        <td>高级主持人</td>
                                        <td><span class="status-badge status-enabled">启用</span></td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewHost('H001')">查看</button>
                                            <button class="btn-action btn-action-disable" onclick="disableHost('H001')">停用</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>H002</td>
                                        <td>李主持</td>
                                        <td>13800238000</td>
                                        <td>lizhuchi@example.com</td>
                                        <td>10年以上</td>
                                        <td>特级主持人</td>
                                        <td><span class="status-badge status-enabled">启用</span></td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewHost('H002')">查看</button>
                                            <button class="btn-action btn-action-disable" onclick="disableHost('H002')">停用</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>H003</td>
                                        <td>王主持</td>
                                        <td>13700337000</td>
                                        <td>wangzhuchi@example.com</td>
                                        <td>3-5年</td>
                                        <td>中级主持人</td>
                                        <td><span class="status-badge status-disabled">停用</span></td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewHost('H003')">查看</button>
                                            <button class="btn-action btn-action-enable" onclick="enableHost('H003')">启用</button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <!-- 编辑主持人模态框 -->
    <div id="editHostModal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2 class="modal-title">编辑主持人信息</h2>
                <span class="close" onclick="closeEditModal()">&times;</span>
            </div>
            <form id="edit-host-form">
                <div class="form-grid">
                    <div class="form-group">
                        <label class="form-label">主持人姓名 *</label>
                        <input type="text" class="form-input" name="editHostName" id="editHostName" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label">联系电话 *</label>
                        <input type="tel" class="form-input" name="editHostPhone" id="editHostPhone" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label">身份证号 *</label>
                        <input type="text" class="form-input" name="editHostIdCard" id="editHostIdCard" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label">邮箱地址</label>
                        <input type="email" class="form-input" name="editHostEmail" id="editHostEmail">
                    </div>
                    <div class="form-group">
                        <label class="form-label">工作经验 *</label>
                        <select class="form-input" name="editHostExperience" id="editHostExperience" required>
                            <option value="">请选择工作经验</option>
                            <option value="1-3年">1-3年</option>
                            <option value="3-5年">3-5年</option>
                            <option value="5-10年">5-10年</option>
                            <option value="10年以上">10年以上</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="form-label">专业资质</label>
                        <select class="form-input" name="editHostQualification" id="editHostQualification">
                            <option value="">请选择专业资质</option>
                            <option value="初级主持人">初级主持人</option>
                            <option value="中级主持人">中级主持人</option>
                            <option value="高级主持人">高级主持人</option>
                            <option value="特级主持人">特级主持人</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">个人简介</label>
                    <textarea class="form-textarea" name="editHostBio" id="editHostBio" placeholder="请描述主持人的专业背景、特长和工作经历..."></textarea>
                </div>
                <div class="form-actions">
                    <button type="button" class="btn-secondary" onclick="closeEditModal()">取消</button>
                    <button type="submit" class="btn-primary">保存修改</button>
                </div>
            </form>
        </div>
    </div>

    <script>
        // 页面加载时设置用户信息
        document.addEventListener('DOMContentLoaded', function() {
            const currentUser = localStorage.getItem('hostCurrentUser');
            if (currentUser) {
                const user = JSON.parse(currentUser);
                document.getElementById('current-user-name').textContent = user.name || '主持人管理员';
                document.getElementById('current-user-role').textContent = user.role || '主持人管理员';
            }
        });

        // 功能切换
        function switchFunction(functionName) {
            // 移除所有活动状态
            document.querySelectorAll('.nav-link').forEach(link => {
                link.classList.remove('active');
            });
            
            // 添加活动状态到当前点击的链接
            event.target.closest('.nav-link').classList.add('active');
            
            // 隐藏所有内容
            const allContent = document.querySelectorAll('.content-section');
            allContent.forEach(content => {
                content.style.display = 'none';
            });

            // 显示对应内容
            const targetContent = document.getElementById(functionName + '-content');
            if (targetContent) {
                targetContent.style.display = 'block';
            }
        }

        // 新增主持人相关函数
        document.getElementById('add-host-form').addEventListener('submit', function(e) {
            e.preventDefault();
            const formData = new FormData(this);
            
            const hostData = {
                id: 'H' + Date.now(),
                name: formData.get('hostName'),
                phone: formData.get('hostPhone'),
                idCard: formData.get('hostIdCard'),
                email: formData.get('hostEmail'),
                experience: formData.get('hostExperience'),
                qualification: formData.get('hostQualification'),
                bio: formData.get('hostBio'),
                status: 'enabled',
                createTime: new Date().toISOString()
            };

            console.log('添加主持人数据:', hostData);
            alert('主持人添加成功！');
            
            this.reset();
        });

        function resetAddForm() {
            document.getElementById('add-host-form').reset();
        }

        // 修改主持人相关函数
        function searchModifyHosts() {
            const name = document.getElementById('modify-host-name-search').value;
            const experience = document.getElementById('modify-host-experience-search').value;
            const status = document.getElementById('modify-host-status-search').value;
            alert(`搜索修改主持人: 姓名: ${name}, 经验: ${experience}, 状态: ${status}`);
        }

        function clearModifySearch() {
            document.getElementById('modify-host-name-search').value = '';
            document.getElementById('modify-host-experience-search').value = '';
            document.getElementById('modify-host-status-search').value = '';
        }

        // 删除主持人相关函数
        function searchDeleteHosts() {
            const name = document.getElementById('delete-host-name-search').value;
            const experience = document.getElementById('delete-host-experience-search').value;
            const status = document.getElementById('delete-host-status-search').value;
            alert(`搜索删除主持人: 姓名: ${name}, 经验: ${experience}, 状态: ${status}`);
        }

        function clearDeleteSearch() {
            document.getElementById('delete-host-name-search').value = '';
            document.getElementById('delete-host-experience-search').value = '';
            document.getElementById('delete-host-status-search').value = '';
        }

        // 启用/停用主持人相关函数
        function searchStatusHosts() {
            const name = document.getElementById('status-host-name-search').value;
            const experience = document.getElementById('status-host-experience-search').value;
            const status = document.getElementById('status-host-status-search').value;
            alert(`搜索状态主持人: 姓名: ${name}, 经验: ${experience}, 状态: ${status}`);
        }

        function clearStatusSearch() {
            document.getElementById('status-host-name-search').value = '';
            document.getElementById('status-host-experience-search').value = '';
            document.getElementById('status-host-status-search').value = '';
        }

        // 主持人操作函数
        function viewHost(id) {
            alert(`查看主持人详情 ID: ${id}`);
        }

        function editHost(id) {
            // 打开编辑模态框
            document.getElementById('editHostModal').style.display = 'block';
            // 这里应该从数据库获取主持人信息并填充表单
            // 示例数据填充
            if (id === 'H001') {
                document.getElementById('editHostName').value = '张主持';
                document.getElementById('editHostPhone').value = '13900139000';
                document.getElementById('editHostIdCard').value = '110101199001011234';
                document.getElementById('editHostEmail').value = 'zhangzhuchi@example.com';
                document.getElementById('editHostExperience').value = '5-10年';
                document.getElementById('editHostQualification').value = '高级主持人';
                document.getElementById('editHostBio').value = '资深主持人，具有丰富的告别仪式主持经验。';
            }
        }

        function deleteHost(id) {
            if (confirm('确定要删除这个主持人吗？删除后将无法恢复！')) {
                alert(`删除主持人 ID: ${id}`);
                // 这里应该调用删除API
            }
        }

        function enableHost(id) {
            if (confirm('确定要启用这个主持人吗？')) {
                alert(`启用主持人 ID: ${id}`);
                // 这里应该调用启用API
                // 更新UI状态
            }
        }

        function disableHost(id) {
            if (confirm('确定要停用这个主持人吗？')) {
                alert(`停用主持人 ID: ${id}`);
                // 这里应该调用停用API
                // 更新UI状态
            }
        }

        // 编辑模态框相关函数
        function closeEditModal() {
            document.getElementById('editHostModal').style.display = 'none';
        }

        document.getElementById('edit-host-form').addEventListener('submit', function(e) {
            e.preventDefault();
            const formData = new FormData(this);
            
            const hostData = {
                name: formData.get('editHostName'),
                phone: formData.get('editHostPhone'),
                idCard: formData.get('editHostIdCard'),
                email: formData.get('editHostEmail'),
                experience: formData.get('editHostExperience'),
                qualification: formData.get('editHostQualification'),
                bio: formData.get('editHostBio'),
                updateTime: new Date().toISOString()
            };

            console.log('修改主持人数据:', hostData);
            alert('主持人信息修改成功！');
            
            closeEditModal();
        });

        // 点击模态框外部关闭
        window.onclick = function(event) {
            const modal = document.getElementById('editHostModal');
            if (event.target == modal) {
                closeEditModal();
            }
        }

        // 退出登录
        function logout() {
            localStorage.removeItem('hostIsLoggedIn');
            localStorage.removeItem('hostCurrentUser');
            window.location.href = 'organ-donation-management.html';
        }
    </script>
</body>
</html>
